﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using NetROS.Tiers.Entities;
using NetROS.Tiers.Data;

#endregion

namespace NetROS.Tiers.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="OrganizacijaProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class OrganizacijaProviderBaseCore : EntityProviderBase<NetROS.Tiers.Entities.Organizacija, NetROS.Tiers.Entities.OrganizacijaKey>
	{		
		#region Get from Many To Many Relationship Functions
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, NetROS.Tiers.Entities.OrganizacijaKey key)
		{
			return Delete(transactionManager, key.ID);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="iD">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 iD)
		{
			return Delete(null, iD);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iD">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 iD);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblMjesto key.
		///		FK_tblOrganizacija_tblMjesto Description: 
		/// </summary>
		/// <param name="iDMjesto"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDMjesto(System.Int32? iDMjesto)
		{
			int count = -1;
			return GetByIDMjesto(iDMjesto, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblMjesto key.
		///		FK_tblOrganizacija_tblMjesto Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDMjesto"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDMjesto(TransactionManager transactionManager, System.Int32? iDMjesto)
		{
			int count = -1;
			return GetByIDMjesto(transactionManager, iDMjesto, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblMjesto key.
		///		FK_tblOrganizacija_tblMjesto Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDMjesto"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDMjesto(TransactionManager transactionManager, System.Int32? iDMjesto, int start, int pageLength)
		{
			int count = -1;
			return GetByIDMjesto(transactionManager, iDMjesto, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblMjesto key.
		///		fK_tblOrganizacija_tblMjesto Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDMjesto"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDMjesto(System.Int32? iDMjesto, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDMjesto(null, iDMjesto, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblMjesto key.
		///		fK_tblOrganizacija_tblMjesto Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDMjesto"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDMjesto(System.Int32? iDMjesto, int start, int pageLength,out int count)
		{
			return GetByIDMjesto(null, iDMjesto, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblMjesto key.
		///		FK_tblOrganizacija_tblMjesto Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDMjesto"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<Organizacija> GetByIDMjesto(TransactionManager transactionManager, System.Int32? iDMjesto, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacija key.
		///		FK_tblOrganizacija_tblOrganizacija Description: 
		/// </summary>
		/// <param name="iDRoditelj"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDRoditelj(System.Int32? iDRoditelj)
		{
			int count = -1;
			return GetByIDRoditelj(iDRoditelj, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacija key.
		///		FK_tblOrganizacija_tblOrganizacija Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDRoditelj"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDRoditelj(TransactionManager transactionManager, System.Int32? iDRoditelj)
		{
			int count = -1;
			return GetByIDRoditelj(transactionManager, iDRoditelj, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacija key.
		///		FK_tblOrganizacija_tblOrganizacija Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDRoditelj"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDRoditelj(TransactionManager transactionManager, System.Int32? iDRoditelj, int start, int pageLength)
		{
			int count = -1;
			return GetByIDRoditelj(transactionManager, iDRoditelj, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacija key.
		///		fK_tblOrganizacija_tblOrganizacija Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDRoditelj"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDRoditelj(System.Int32? iDRoditelj, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDRoditelj(null, iDRoditelj, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacija key.
		///		fK_tblOrganizacija_tblOrganizacija Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDRoditelj"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDRoditelj(System.Int32? iDRoditelj, int start, int pageLength,out int count)
		{
			return GetByIDRoditelj(null, iDRoditelj, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacija key.
		///		FK_tblOrganizacija_tblOrganizacija Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDRoditelj"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<Organizacija> GetByIDRoditelj(TransactionManager transactionManager, System.Int32? iDRoditelj, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacijaTip key.
		///		FK_tblOrganizacija_tblOrganizacijaTip Description: 
		/// </summary>
		/// <param name="iDTip"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDTip(System.Int32 iDTip)
		{
			int count = -1;
			return GetByIDTip(iDTip, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacijaTip key.
		///		FK_tblOrganizacija_tblOrganizacijaTip Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDTip"></param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		/// <remarks></remarks>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDTip(TransactionManager transactionManager, System.Int32 iDTip)
		{
			int count = -1;
			return GetByIDTip(transactionManager, iDTip, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacijaTip key.
		///		FK_tblOrganizacija_tblOrganizacijaTip Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDTip"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDTip(TransactionManager transactionManager, System.Int32 iDTip, int start, int pageLength)
		{
			int count = -1;
			return GetByIDTip(transactionManager, iDTip, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacijaTip key.
		///		fK_tblOrganizacija_tblOrganizacijaTip Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDTip"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDTip(System.Int32 iDTip, int start, int pageLength)
		{
			int count =  -1;
			return GetByIDTip(null, iDTip, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacijaTip key.
		///		fK_tblOrganizacija_tblOrganizacijaTip Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDTip"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByIDTip(System.Int32 iDTip, int start, int pageLength,out int count)
		{
			return GetByIDTip(null, iDTip, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_tblOrganizacija_tblOrganizacijaTip key.
		///		FK_tblOrganizacija_tblOrganizacijaTip Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDTip"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of NetROS.Tiers.Entities.Organizacija objects.</returns>
		public abstract NetROS.Tiers.Entities.TList<Organizacija> GetByIDTip(TransactionManager transactionManager, System.Int32 iDTip, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override NetROS.Tiers.Entities.Organizacija Get(TransactionManager transactionManager, NetROS.Tiers.Entities.OrganizacijaKey key, int start, int pageLength)
		{
			return GetByID(transactionManager, key.ID, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key IX_Organizacija_ID_Hierarchy index.
		/// </summary>
		/// <param name="hierarchy"></param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.TList&lt;Organizacija&gt;"/> class.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByHierarchy(System.String hierarchy)
		{
			int count = -1;
			return GetByHierarchy(null,hierarchy, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Organizacija_ID_Hierarchy index.
		/// </summary>
		/// <param name="hierarchy"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.TList&lt;Organizacija&gt;"/> class.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByHierarchy(System.String hierarchy, int start, int pageLength)
		{
			int count = -1;
			return GetByHierarchy(null, hierarchy, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Organizacija_ID_Hierarchy index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="hierarchy"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.TList&lt;Organizacija&gt;"/> class.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByHierarchy(TransactionManager transactionManager, System.String hierarchy)
		{
			int count = -1;
			return GetByHierarchy(transactionManager, hierarchy, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Organizacija_ID_Hierarchy index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="hierarchy"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.TList&lt;Organizacija&gt;"/> class.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByHierarchy(TransactionManager transactionManager, System.String hierarchy, int start, int pageLength)
		{
			int count = -1;
			return GetByHierarchy(transactionManager, hierarchy, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Organizacija_ID_Hierarchy index.
		/// </summary>
		/// <param name="hierarchy"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.TList&lt;Organizacija&gt;"/> class.</returns>
		public NetROS.Tiers.Entities.TList<Organizacija> GetByHierarchy(System.String hierarchy, int start, int pageLength, out int count)
		{
			return GetByHierarchy(null, hierarchy, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Organizacija_ID_Hierarchy index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="hierarchy"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.TList&lt;Organizacija&gt;"/> class.</returns>
		public abstract NetROS.Tiers.Entities.TList<Organizacija> GetByHierarchy(TransactionManager transactionManager, System.String hierarchy, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key IX_SifraSkladista index.
		/// </summary>
		/// <param name="sifraSkladista"></param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetBySifraSkladista(System.String sifraSkladista)
		{
			int count = -1;
			return GetBySifraSkladista(null,sifraSkladista, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_SifraSkladista index.
		/// </summary>
		/// <param name="sifraSkladista"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetBySifraSkladista(System.String sifraSkladista, int start, int pageLength)
		{
			int count = -1;
			return GetBySifraSkladista(null, sifraSkladista, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_SifraSkladista index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="sifraSkladista"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetBySifraSkladista(TransactionManager transactionManager, System.String sifraSkladista)
		{
			int count = -1;
			return GetBySifraSkladista(transactionManager, sifraSkladista, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_SifraSkladista index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="sifraSkladista"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetBySifraSkladista(TransactionManager transactionManager, System.String sifraSkladista, int start, int pageLength)
		{
			int count = -1;
			return GetBySifraSkladista(transactionManager, sifraSkladista, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_SifraSkladista index.
		/// </summary>
		/// <param name="sifraSkladista"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetBySifraSkladista(System.String sifraSkladista, int start, int pageLength, out int count)
		{
			return GetBySifraSkladista(null, sifraSkladista, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_SifraSkladista index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="sifraSkladista"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public abstract NetROS.Tiers.Entities.Organizacija GetBySifraSkladista(TransactionManager transactionManager, System.String sifraSkladista, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_tblOrganizacija index.
		/// </summary>
		/// <param name="iD"></param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetByID(System.Int32 iD)
		{
			int count = -1;
			return GetByID(null,iD, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOrganizacija index.
		/// </summary>
		/// <param name="iD"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetByID(System.Int32 iD, int start, int pageLength)
		{
			int count = -1;
			return GetByID(null, iD, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOrganizacija index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iD"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetByID(TransactionManager transactionManager, System.Int32 iD)
		{
			int count = -1;
			return GetByID(transactionManager, iD, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOrganizacija index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iD"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetByID(TransactionManager transactionManager, System.Int32 iD, int start, int pageLength)
		{
			int count = -1;
			return GetByID(transactionManager, iD, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOrganizacija index.
		/// </summary>
		/// <param name="iD"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public NetROS.Tiers.Entities.Organizacija GetByID(System.Int32 iD, int start, int pageLength, out int count)
		{
			return GetByID(null, iD, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tblOrganizacija index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iD"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.Organizacija"/> class.</returns>
		public abstract NetROS.Tiers.Entities.Organizacija GetByID(TransactionManager transactionManager, System.Int32 iD, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#region _tblOrganizacija_GetParentDirektorPorezniBroj 
		
		/// <summary>
		///	This method wrap the '_tblOrganizacija_GetParentDirektorPorezniBroj' stored procedure. 
		/// </summary>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Organizacija&gt;"/> instance.</returns>
		public TList<Organizacija> GetParentDirektorPorezniBroj(System.Int32? @IDOrg)
		{
			return GetParentDirektorPorezniBroj(null, 0, int.MaxValue , @IDOrg);
		}
		
		/// <summary>
		///	This method wrap the '_tblOrganizacija_GetParentDirektorPorezniBroj' stored procedure. 
		/// </summary>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Organizacija&gt;"/> instance.</returns>
		public TList<Organizacija> GetParentDirektorPorezniBroj(int start, int pageLength, System.Int32? @IDOrg)
		{
			return GetParentDirektorPorezniBroj(null, start, pageLength , @IDOrg);
		}
				
		/// <summary>
		///	This method wrap the '_tblOrganizacija_GetParentDirektorPorezniBroj' stored procedure. 
		/// </summary>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Organizacija&gt;"/> instance.</returns>
		public TList<Organizacija> GetParentDirektorPorezniBroj(TransactionManager transactionManager, System.Int32? @IDOrg)
		{
			return GetParentDirektorPorezniBroj(transactionManager, 0, int.MaxValue , @IDOrg);
		}
		
		/// <summary>
		///	This method wrap the '_tblOrganizacija_GetParentDirektorPorezniBroj' stored procedure. 
		/// </summary>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Organizacija&gt;"/> instance.</returns>
		public abstract TList<Organizacija> GetParentDirektorPorezniBroj(TransactionManager transactionManager, int start, int pageLength , System.Int32? @IDOrg);
		
		#endregion
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a NetROS.Tiers.Entities.TList&lt;Organizacija&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="NetROS.Tiers.Entities.TList&lt;Organizacija&gt;"/></returns>
		public static NetROS.Tiers.Entities.TList<Organizacija> Fill(IDataReader reader, NetROS.Tiers.Entities.TList<Organizacija> rows, int start, int pageLength)
		{
		// advance to the starting row
		for (int i = 0; i < start; i++)
		{
			if (!reader.Read())
			return rows; // not enough rows, just return
		}
		for (int i = 0; i < pageLength; i++)
		{
			if (!reader.Read())
			break; // we are done
			string key = null;
			
			NetROS.Tiers.Entities.Organizacija c = null;
			if (DataRepository.Provider.UseEntityFactory)
			{
			key = new System.Text.StringBuilder("Organizacija")
			.Append("|").Append((reader.IsDBNull(((int)NetROS.Tiers.Entities.OrganizacijaColumn.ID - 1))?(int)0:(System.Int32)reader[((int)NetROS.Tiers.Entities.OrganizacijaColumn.ID - 1)]).ToString()).ToString();
			c = EntityManager.LocateOrCreate<Organizacija>(
			key.ToString(), // EntityTrackingKey
			"Organizacija",  //Creational Type
			DataRepository.Provider.EntityCreationalFactoryType,  //Factory used to create entity
			DataRepository.Provider.EnableEntityTracking); // Track this entity?
			}
			else
			{
			c = new NetROS.Tiers.Entities.Organizacija();
			}
			
			if (!DataRepository.Provider.EnableEntityTracking ||
			c.EntityState == EntityState.Added ||
			(DataRepository.Provider.EnableEntityTracking &&
			((DataRepository.Provider.CurrentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
			(DataRepository.Provider.CurrentLoadPolicy == LoadPolicy.DiscardChanges && (c.EntityState == EntityState.Unchanged ||
								c.EntityState == EntityState.Changed)))))
						{
			c.SuppressEntityEvents = true;
			c.ID = (System.Int32)reader["ID"];
			c.Naziv = (System.String)reader["Naziv"];
			c.IDRoditelj = reader.IsDBNull(reader.GetOrdinal("IDRoditelj")) ? null : (System.Int32?)reader["IDRoditelj"];
			c.Hierarchy = (System.String)reader["Hierarchy"];
			c.Lvl = reader.IsDBNull(reader.GetOrdinal("Lvl")) ? null : (System.Int32?)reader["Lvl"];
			c.IDTip = (System.Int32)reader["IDTip"];
			c.SifraSkladista = (System.String)reader["SifraSkladista"];
			c.Grupa = reader.IsDBNull(reader.GetOrdinal("Grupa")) ? null : (System.String)reader["Grupa"];
			c.Telefon = reader.IsDBNull(reader.GetOrdinal("Telefon")) ? null : (System.String)reader["Telefon"];
			c.Fax = reader.IsDBNull(reader.GetOrdinal("Fax")) ? null : (System.String)reader["Fax"];
			c.Adresa = reader.IsDBNull(reader.GetOrdinal("Adresa")) ? null : (System.String)reader["Adresa"];
			c.EMail = reader.IsDBNull(reader.GetOrdinal("EMail")) ? null : (System.String)reader["EMail"];
			c.IDMjesto = reader.IsDBNull(reader.GetOrdinal("IDMjesto")) ? null : (System.Int32?)reader["IDMjesto"];
			c.Direktor = reader.IsDBNull(reader.GetOrdinal("Direktor")) ? null : (System.String)reader["Direktor"];
			c.Poreznibroj = reader.IsDBNull(reader.GetOrdinal("Poreznibroj")) ? null : (System.String)reader["Poreznibroj"];
			c.OznakaDjelatnosti = reader.IsDBNull(reader.GetOrdinal("OznakaDjelatnosti")) ? null : (System.String)reader["OznakaDjelatnosti"];
			c.NadleznaIspostavaPorUp = reader.IsDBNull(reader.GetOrdinal("NadleznaIspostavaPorUp")) ? null : (System.String)reader["NadleznaIspostavaPorUp"];
			c.OrgOIB = reader.IsDBNull(reader.GetOrdinal("OrgOIB")) ? null : (System.String)reader["OrgOIB"];
			c.CalculatedHierarchy = (System.String)reader["CalculatedHierarchy"];
			c.EntityTrackingKey = key;
			c.AcceptChanges();
			c.SuppressEntityEvents = false;
			}
			rows.Add(c);
		}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="NetROS.Tiers.Entities.Organizacija"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.Organizacija"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, NetROS.Tiers.Entities.Organizacija entity)
		{
			if (!reader.Read()) return;
			
			entity.ID = (System.Int32)reader["ID"];
			entity.Naziv = (System.String)reader["Naziv"];
			entity.IDRoditelj = reader.IsDBNull(reader.GetOrdinal("IDRoditelj")) ? null : (System.Int32?)reader["IDRoditelj"];
			entity.Hierarchy = (System.String)reader["Hierarchy"];
			entity.Lvl = reader.IsDBNull(reader.GetOrdinal("Lvl")) ? null : (System.Int32?)reader["Lvl"];
			entity.IDTip = (System.Int32)reader["IDTip"];
			entity.SifraSkladista = (System.String)reader["SifraSkladista"];
			entity.Grupa = reader.IsDBNull(reader.GetOrdinal("Grupa")) ? null : (System.String)reader["Grupa"];
			entity.Telefon = reader.IsDBNull(reader.GetOrdinal("Telefon")) ? null : (System.String)reader["Telefon"];
			entity.Fax = reader.IsDBNull(reader.GetOrdinal("Fax")) ? null : (System.String)reader["Fax"];
			entity.Adresa = reader.IsDBNull(reader.GetOrdinal("Adresa")) ? null : (System.String)reader["Adresa"];
			entity.EMail = reader.IsDBNull(reader.GetOrdinal("EMail")) ? null : (System.String)reader["EMail"];
			entity.IDMjesto = reader.IsDBNull(reader.GetOrdinal("IDMjesto")) ? null : (System.Int32?)reader["IDMjesto"];
			entity.Direktor = reader.IsDBNull(reader.GetOrdinal("Direktor")) ? null : (System.String)reader["Direktor"];
			entity.Poreznibroj = reader.IsDBNull(reader.GetOrdinal("Poreznibroj")) ? null : (System.String)reader["Poreznibroj"];
			entity.OznakaDjelatnosti = reader.IsDBNull(reader.GetOrdinal("OznakaDjelatnosti")) ? null : (System.String)reader["OznakaDjelatnosti"];
			entity.NadleznaIspostavaPorUp = reader.IsDBNull(reader.GetOrdinal("NadleznaIspostavaPorUp")) ? null : (System.String)reader["NadleznaIspostavaPorUp"];
			entity.OrgOIB = reader.IsDBNull(reader.GetOrdinal("OrgOIB")) ? null : (System.String)reader["OrgOIB"];
			entity.CalculatedHierarchy = (System.String)reader["CalculatedHierarchy"];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="NetROS.Tiers.Entities.Organizacija"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.Organizacija"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, NetROS.Tiers.Entities.Organizacija entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.ID = (System.Int32)dataRow["ID"];
			entity.Naziv = (System.String)dataRow["Naziv"];
			entity.IDRoditelj = Convert.IsDBNull(dataRow["IDRoditelj"]) ? null : (System.Int32?)dataRow["IDRoditelj"];
			entity.Hierarchy = (System.String)dataRow["Hierarchy"];
			entity.Lvl = Convert.IsDBNull(dataRow["Lvl"]) ? null : (System.Int32?)dataRow["Lvl"];
			entity.IDTip = (System.Int32)dataRow["IDTip"];
			entity.SifraSkladista = (System.String)dataRow["SifraSkladista"];
			entity.Grupa = Convert.IsDBNull(dataRow["Grupa"]) ? null : (System.String)dataRow["Grupa"];
			entity.Telefon = Convert.IsDBNull(dataRow["Telefon"]) ? null : (System.String)dataRow["Telefon"];
			entity.Fax = Convert.IsDBNull(dataRow["Fax"]) ? null : (System.String)dataRow["Fax"];
			entity.Adresa = Convert.IsDBNull(dataRow["Adresa"]) ? null : (System.String)dataRow["Adresa"];
			entity.EMail = Convert.IsDBNull(dataRow["EMail"]) ? null : (System.String)dataRow["EMail"];
			entity.IDMjesto = Convert.IsDBNull(dataRow["IDMjesto"]) ? null : (System.Int32?)dataRow["IDMjesto"];
			entity.Direktor = Convert.IsDBNull(dataRow["Direktor"]) ? null : (System.String)dataRow["Direktor"];
			entity.Poreznibroj = Convert.IsDBNull(dataRow["Poreznibroj"]) ? null : (System.String)dataRow["Poreznibroj"];
			entity.OznakaDjelatnosti = Convert.IsDBNull(dataRow["OznakaDjelatnosti"]) ? null : (System.String)dataRow["OznakaDjelatnosti"];
			entity.NadleznaIspostavaPorUp = Convert.IsDBNull(dataRow["NadleznaIspostavaPorUp"]) ? null : (System.String)dataRow["NadleznaIspostavaPorUp"];
			entity.OrgOIB = Convert.IsDBNull(dataRow["OrgOIB"]) ? null : (System.String)dataRow["OrgOIB"];
			entity.CalculatedHierarchy = (System.String)dataRow["CalculatedHierarchy"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.Organizacija"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">NetROS.Tiers.Entities.Organizacija Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		internal override void DeepLoad(TransactionManager transactionManager, NetROS.Tiers.Entities.Organizacija entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region IDMjestoSource	
			if (CanDeepLoad(entity, "Mjesto|IDMjestoSource", deepLoadType, innerList) 
				&& entity.IDMjestoSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.IDMjesto ?? (int)0);
				Mjesto tmpEntity = EntityManager.LocateEntity<Mjesto>(EntityLocator.ConstructKeyFromPkItems(typeof(Mjesto), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDMjestoSource = tmpEntity;
				else
					entity.IDMjestoSource = DataRepository.MjestoProvider.GetByID(transactionManager, (entity.IDMjesto ?? (int)0));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDMjestoSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDMjestoSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.MjestoProvider.DeepLoad(transactionManager, entity.IDMjestoSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDMjestoSource

			#region IDRoditeljSource	
			if (CanDeepLoad(entity, "Organizacija|IDRoditeljSource", deepLoadType, innerList) 
				&& entity.IDRoditeljSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.IDRoditelj ?? (int)0);
				Organizacija tmpEntity = EntityManager.LocateEntity<Organizacija>(EntityLocator.ConstructKeyFromPkItems(typeof(Organizacija), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDRoditeljSource = tmpEntity;
				else
					entity.IDRoditeljSource = DataRepository.OrganizacijaProvider.GetByID(transactionManager, (entity.IDRoditelj ?? (int)0));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDRoditeljSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDRoditeljSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.OrganizacijaProvider.DeepLoad(transactionManager, entity.IDRoditeljSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDRoditeljSource

			#region IDTipSource	
			if (CanDeepLoad(entity, "OrganizacijaTip|IDTipSource", deepLoadType, innerList) 
				&& entity.IDTipSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IDTip;
				OrganizacijaTip tmpEntity = EntityManager.LocateEntity<OrganizacijaTip>(EntityLocator.ConstructKeyFromPkItems(typeof(OrganizacijaTip), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IDTipSource = tmpEntity;
				else
					entity.IDTipSource = DataRepository.OrganizacijaTipProvider.GetByID(transactionManager, entity.IDTip);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IDTipSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IDTipSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.OrganizacijaTipProvider.DeepLoad(transactionManager, entity.IDTipSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IDTipSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByID methods when available
			
			#region ObracunKamataProknjizenCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<ObracunKamataProknjizen>|ObracunKamataProknjizenCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'ObracunKamataProknjizenCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.ObracunKamataProknjizenCollection = DataRepository.ObracunKamataProknjizenProvider.GetByIDOrganizacija(transactionManager, entity.ID);

				if (deep && entity.ObracunKamataProknjizenCollection.Count > 0)
				{
					deepHandles.Add("ObracunKamataProknjizenCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<ObracunKamataProknjizen>) DataRepository.ObracunKamataProknjizenProvider.DeepLoad,
						new object[] { transactionManager, entity.ObracunKamataProknjizenCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region DjelatnikCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Djelatnik>|DjelatnikCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DjelatnikCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.DjelatnikCollection = DataRepository.DjelatnikProvider.GetByIDOrganizacija(transactionManager, entity.ID);

				if (deep && entity.DjelatnikCollection.Count > 0)
				{
					deepHandles.Add("DjelatnikCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Djelatnik>) DataRepository.DjelatnikProvider.DeepLoad,
						new object[] { transactionManager, entity.DjelatnikCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region OrganizacijaZiroRacunCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<OrganizacijaZiroRacun>|OrganizacijaZiroRacunCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'OrganizacijaZiroRacunCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.OrganizacijaZiroRacunCollection = DataRepository.OrganizacijaZiroRacunProvider.GetByIDOrganizacija(transactionManager, entity.ID);

				if (deep && entity.OrganizacijaZiroRacunCollection.Count > 0)
				{
					deepHandles.Add("OrganizacijaZiroRacunCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<OrganizacijaZiroRacun>) DataRepository.OrganizacijaZiroRacunProvider.DeepLoad,
						new object[] { transactionManager, entity.OrganizacijaZiroRacunCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region DokumentCollectionGetByIDOrganizacijaPrema
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Dokument>|DokumentCollectionGetByIDOrganizacijaPrema", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DokumentCollectionGetByIDOrganizacijaPrema' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.DokumentCollectionGetByIDOrganizacijaPrema = DataRepository.DokumentProvider.GetByIDOrganizacijaPrema(transactionManager, entity.ID);

				if (deep && entity.DokumentCollectionGetByIDOrganizacijaPrema.Count > 0)
				{
					deepHandles.Add("DokumentCollectionGetByIDOrganizacijaPrema",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Dokument>) DataRepository.DokumentProvider.DeepLoad,
						new object[] { transactionManager, entity.DokumentCollectionGetByIDOrganizacijaPrema, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region KnjizenjeStavkaCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<KnjizenjeStavka>|KnjizenjeStavkaCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'KnjizenjeStavkaCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.KnjizenjeStavkaCollection = DataRepository.KnjizenjeStavkaProvider.GetByIDOrganizacija(transactionManager, entity.ID);

				if (deep && entity.KnjizenjeStavkaCollection.Count > 0)
				{
					deepHandles.Add("KnjizenjeStavkaCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<KnjizenjeStavka>) DataRepository.KnjizenjeStavkaProvider.DeepLoad,
						new object[] { transactionManager, entity.KnjizenjeStavkaCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region DokumentCollectionGetByIDOrganizacijaOd
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Dokument>|DokumentCollectionGetByIDOrganizacijaOd", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DokumentCollectionGetByIDOrganizacijaOd' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.DokumentCollectionGetByIDOrganizacijaOd = DataRepository.DokumentProvider.GetByIDOrganizacijaOd(transactionManager, entity.ID);

				if (deep && entity.DokumentCollectionGetByIDOrganizacijaOd.Count > 0)
				{
					deepHandles.Add("DokumentCollectionGetByIDOrganizacijaOd",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Dokument>) DataRepository.DokumentProvider.DeepLoad,
						new object[] { transactionManager, entity.DokumentCollectionGetByIDOrganizacijaOd, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region OrganizacijaCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Organizacija>|OrganizacijaCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'OrganizacijaCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.OrganizacijaCollection = DataRepository.OrganizacijaProvider.GetByIDRoditelj(transactionManager, entity.ID);

				if (deep && entity.OrganizacijaCollection.Count > 0)
				{
					deepHandles.Add("OrganizacijaCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Organizacija>) DataRepository.OrganizacijaProvider.DeepLoad,
						new object[] { transactionManager, entity.OrganizacijaCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region ObracunKamataCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<ObracunKamata>|ObracunKamataCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'ObracunKamataCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.ObracunKamataCollection = DataRepository.ObracunKamataProvider.GetByIDOrganizacija(transactionManager, entity.ID);

				if (deep && entity.ObracunKamataCollection.Count > 0)
				{
					deepHandles.Add("ObracunKamataCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<ObracunKamata>) DataRepository.ObracunKamataProvider.DeepLoad,
						new object[] { transactionManager, entity.ObracunKamataCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region DokumentStavkaCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<DokumentStavka>|DokumentStavkaCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DokumentStavkaCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.DokumentStavkaCollection = DataRepository.DokumentStavkaProvider.GetByIDOrgJedOd(transactionManager, entity.ID);

				if (deep && entity.DokumentStavkaCollection.Count > 0)
				{
					deepHandles.Add("DokumentStavkaCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<DokumentStavka>) DataRepository.DokumentStavkaProvider.DeepLoad,
						new object[] { transactionManager, entity.DokumentStavkaCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region BlagajnaCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Blagajna>|BlagajnaCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'BlagajnaCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.BlagajnaCollection = DataRepository.BlagajnaProvider.GetByIDOrganizacija(transactionManager, entity.ID);

				if (deep && entity.BlagajnaCollection.Count > 0)
				{
					deepHandles.Add("BlagajnaCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Blagajna>) DataRepository.BlagajnaProvider.DeepLoad,
						new object[] { transactionManager, entity.BlagajnaCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region OSKarticaCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<OSKartica>|OSKarticaCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'OSKarticaCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.OSKarticaCollection = DataRepository.OSKarticaProvider.GetByIDOrgJed(transactionManager, entity.ID);

				if (deep && entity.OSKarticaCollection.Count > 0)
				{
					deepHandles.Add("OSKarticaCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<OSKartica>) DataRepository.OSKarticaProvider.DeepLoad,
						new object[] { transactionManager, entity.OSKarticaCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the NetROS.Tiers.Entities.Organizacija object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">NetROS.Tiers.Entities.Organizacija instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">NetROS.Tiers.Entities.Organizacija Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		internal override bool DeepSave(TransactionManager transactionManager, NetROS.Tiers.Entities.Organizacija entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region IDMjestoSource
			if (CanDeepSave(entity, "Mjesto|IDMjestoSource", deepSaveType, innerList) 
				&& entity.IDMjestoSource != null)
			{
				DataRepository.MjestoProvider.Save(transactionManager, entity.IDMjestoSource);
				entity.IDMjesto = entity.IDMjestoSource.ID;
			}
			#endregion 
			
			#region IDRoditeljSource
			if (CanDeepSave(entity, "Organizacija|IDRoditeljSource", deepSaveType, innerList) 
				&& entity.IDRoditeljSource != null)
			{
				DataRepository.OrganizacijaProvider.Save(transactionManager, entity.IDRoditeljSource);
				entity.IDRoditelj = entity.IDRoditeljSource.ID;
			}
			#endregion 
			
			#region IDTipSource
			if (CanDeepSave(entity, "OrganizacijaTip|IDTipSource", deepSaveType, innerList) 
				&& entity.IDTipSource != null)
			{
				DataRepository.OrganizacijaTipProvider.Save(transactionManager, entity.IDTipSource);
				entity.IDTip = entity.IDTipSource.ID;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<Delegate, object> deepHandles = new Dictionary<Delegate, object>();
	
			#region List<ObracunKamataProknjizen>
				if (CanDeepSave(entity.ObracunKamataProknjizenCollection, "List<ObracunKamataProknjizen>|ObracunKamataProknjizenCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(ObracunKamataProknjizen child in entity.ObracunKamataProknjizenCollection)
					{
						if(child.IDOrganizacijaSource != null)
							child.IDOrganizacija = child.IDOrganizacijaSource.ID;
						else
							child.IDOrganizacija = entity.ID;

					}

					if (entity.ObracunKamataProknjizenCollection.Count > 0 || entity.ObracunKamataProknjizenCollection.DeletedItems.Count > 0)
					{
						DataRepository.ObracunKamataProknjizenProvider.Save(transactionManager, entity.ObracunKamataProknjizenCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< ObracunKamataProknjizen >) DataRepository.ObracunKamataProknjizenProvider.DeepSave,
							new object[] { transactionManager, entity.ObracunKamataProknjizenCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<Djelatnik>
				if (CanDeepSave(entity.DjelatnikCollection, "List<Djelatnik>|DjelatnikCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Djelatnik child in entity.DjelatnikCollection)
					{
						if(child.IDOrganizacijaSource != null)
							child.IDOrganizacija = child.IDOrganizacijaSource.ID;
						else
							child.IDOrganizacija = entity.ID;

					}

					if (entity.DjelatnikCollection.Count > 0 || entity.DjelatnikCollection.DeletedItems.Count > 0)
					{
						DataRepository.DjelatnikProvider.Save(transactionManager, entity.DjelatnikCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< Djelatnik >) DataRepository.DjelatnikProvider.DeepSave,
							new object[] { transactionManager, entity.DjelatnikCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<OrganizacijaZiroRacun>
				if (CanDeepSave(entity.OrganizacijaZiroRacunCollection, "List<OrganizacijaZiroRacun>|OrganizacijaZiroRacunCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(OrganizacijaZiroRacun child in entity.OrganizacijaZiroRacunCollection)
					{
						if(child.IDOrganizacijaSource != null)
							child.IDOrganizacija = child.IDOrganizacijaSource.ID;
						else
							child.IDOrganizacija = entity.ID;

					}

					if (entity.OrganizacijaZiroRacunCollection.Count > 0 || entity.OrganizacijaZiroRacunCollection.DeletedItems.Count > 0)
					{
						DataRepository.OrganizacijaZiroRacunProvider.Save(transactionManager, entity.OrganizacijaZiroRacunCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< OrganizacijaZiroRacun >) DataRepository.OrganizacijaZiroRacunProvider.DeepSave,
							new object[] { transactionManager, entity.OrganizacijaZiroRacunCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<Dokument>
				if (CanDeepSave(entity.DokumentCollectionGetByIDOrganizacijaPrema, "List<Dokument>|DokumentCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Dokument child in entity.DokumentCollectionGetByIDOrganizacijaPrema)
					{
						if(child.IDOrganizacijaPremaSource != null)
							child.IDOrganizacijaPrema = child.IDOrganizacijaPremaSource.ID;
						else
							child.IDOrganizacijaPrema = entity.ID;

					}

					if (entity.DokumentCollectionGetByIDOrganizacijaPrema.Count > 0 || entity.DokumentCollectionGetByIDOrganizacijaPrema.DeletedItems.Count > 0)
					{
						DataRepository.DokumentProvider.Save(transactionManager, entity.DokumentCollectionGetByIDOrganizacijaPrema);
						
						deepHandles.Add(
							(DeepSaveHandle< Dokument >) DataRepository.DokumentProvider.DeepSave,
							new object[] { transactionManager, entity.DokumentCollectionGetByIDOrganizacijaPrema, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<KnjizenjeStavka>
				if (CanDeepSave(entity.KnjizenjeStavkaCollection, "List<KnjizenjeStavka>|KnjizenjeStavkaCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(KnjizenjeStavka child in entity.KnjizenjeStavkaCollection)
					{
						if(child.IDOrganizacijaSource != null)
							child.IDOrganizacija = child.IDOrganizacijaSource.ID;
						else
							child.IDOrganizacija = entity.ID;

					}

					if (entity.KnjizenjeStavkaCollection.Count > 0 || entity.KnjizenjeStavkaCollection.DeletedItems.Count > 0)
					{
						DataRepository.KnjizenjeStavkaProvider.Save(transactionManager, entity.KnjizenjeStavkaCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< KnjizenjeStavka >) DataRepository.KnjizenjeStavkaProvider.DeepSave,
							new object[] { transactionManager, entity.KnjizenjeStavkaCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<Dokument>
				if (CanDeepSave(entity.DokumentCollectionGetByIDOrganizacijaOd, "List<Dokument>|DokumentCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Dokument child in entity.DokumentCollectionGetByIDOrganizacijaOd)
					{
						if(child.IDOrganizacijaOdSource != null)
							child.IDOrganizacijaOd = child.IDOrganizacijaOdSource.ID;
						else
							child.IDOrganizacijaOd = entity.ID;

					}

					if (entity.DokumentCollectionGetByIDOrganizacijaOd.Count > 0 || entity.DokumentCollectionGetByIDOrganizacijaOd.DeletedItems.Count > 0)
					{
						DataRepository.DokumentProvider.Save(transactionManager, entity.DokumentCollectionGetByIDOrganizacijaOd);
						
						deepHandles.Add(
							(DeepSaveHandle< Dokument >) DataRepository.DokumentProvider.DeepSave,
							new object[] { transactionManager, entity.DokumentCollectionGetByIDOrganizacijaOd, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<Organizacija>
				if (CanDeepSave(entity.OrganizacijaCollection, "List<Organizacija>|OrganizacijaCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Organizacija child in entity.OrganizacijaCollection)
					{
						if(child.IDRoditeljSource != null)
							child.IDRoditelj = child.IDRoditeljSource.ID;
						else
							child.IDRoditelj = entity.ID;

					}

					if (entity.OrganizacijaCollection.Count > 0 || entity.OrganizacijaCollection.DeletedItems.Count > 0)
					{
						DataRepository.OrganizacijaProvider.Save(transactionManager, entity.OrganizacijaCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< Organizacija >) DataRepository.OrganizacijaProvider.DeepSave,
							new object[] { transactionManager, entity.OrganizacijaCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<ObracunKamata>
				if (CanDeepSave(entity.ObracunKamataCollection, "List<ObracunKamata>|ObracunKamataCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(ObracunKamata child in entity.ObracunKamataCollection)
					{
						if(child.IDOrganizacijaSource != null)
							child.IDOrganizacija = child.IDOrganizacijaSource.ID;
						else
							child.IDOrganizacija = entity.ID;

					}

					if (entity.ObracunKamataCollection.Count > 0 || entity.ObracunKamataCollection.DeletedItems.Count > 0)
					{
						DataRepository.ObracunKamataProvider.Save(transactionManager, entity.ObracunKamataCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< ObracunKamata >) DataRepository.ObracunKamataProvider.DeepSave,
							new object[] { transactionManager, entity.ObracunKamataCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<DokumentStavka>
				if (CanDeepSave(entity.DokumentStavkaCollection, "List<DokumentStavka>|DokumentStavkaCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(DokumentStavka child in entity.DokumentStavkaCollection)
					{
						if(child.IDOrgJedOdSource != null)
							child.IDOrgJedOd = child.IDOrgJedOdSource.ID;
						else
							child.IDOrgJedOd = entity.ID;

					}

					if (entity.DokumentStavkaCollection.Count > 0 || entity.DokumentStavkaCollection.DeletedItems.Count > 0)
					{
						DataRepository.DokumentStavkaProvider.Save(transactionManager, entity.DokumentStavkaCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< DokumentStavka >) DataRepository.DokumentStavkaProvider.DeepSave,
							new object[] { transactionManager, entity.DokumentStavkaCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<Blagajna>
				if (CanDeepSave(entity.BlagajnaCollection, "List<Blagajna>|BlagajnaCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Blagajna child in entity.BlagajnaCollection)
					{
						if(child.IDOrganizacijaSource != null)
							child.IDOrganizacija = child.IDOrganizacijaSource.ID;
						else
							child.IDOrganizacija = entity.ID;

					}

					if (entity.BlagajnaCollection.Count > 0 || entity.BlagajnaCollection.DeletedItems.Count > 0)
					{
						DataRepository.BlagajnaProvider.Save(transactionManager, entity.BlagajnaCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< Blagajna >) DataRepository.BlagajnaProvider.DeepSave,
							new object[] { transactionManager, entity.BlagajnaCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<OSKartica>
				if (CanDeepSave(entity.OSKarticaCollection, "List<OSKartica>|OSKarticaCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(OSKartica child in entity.OSKarticaCollection)
					{
						if(child.IDOrgJedSource != null)
							child.IDOrgJed = child.IDOrgJedSource.ID;
						else
							child.IDOrgJed = entity.ID;

					}

					if (entity.OSKarticaCollection.Count > 0 || entity.OSKarticaCollection.DeletedItems.Count > 0)
					{
						DataRepository.OSKarticaProvider.Save(transactionManager, entity.OSKarticaCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< OSKartica >) DataRepository.OSKarticaProvider.DeepSave,
							new object[] { transactionManager, entity.OSKarticaCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region OrganizacijaChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>NetROS.Tiers.Entities.Organizacija</c>
	///</summary>
	public enum OrganizacijaChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>Mjesto</c> at IDMjestoSource
		///</summary>
		[ChildEntityType(typeof(Mjesto))]
		Mjesto,
			
		///<summary>
		/// Composite Property for <c>Organizacija</c> at IDRoditeljSource
		///</summary>
		[ChildEntityType(typeof(Organizacija))]
		Organizacija,
			
		///<summary>
		/// Composite Property for <c>OrganizacijaTip</c> at IDTipSource
		///</summary>
		[ChildEntityType(typeof(OrganizacijaTip))]
		OrganizacijaTip,
	
		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for ObracunKamataProknjizenCollection
		///</summary>
		[ChildEntityType(typeof(TList<ObracunKamataProknjizen>))]
		ObracunKamataProknjizenCollection,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for DjelatnikCollection
		///</summary>
		[ChildEntityType(typeof(TList<Djelatnik>))]
		DjelatnikCollection,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for OrganizacijaZiroRacunCollection
		///</summary>
		[ChildEntityType(typeof(TList<OrganizacijaZiroRacun>))]
		OrganizacijaZiroRacunCollection,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for DokumentCollection
		///</summary>
		[ChildEntityType(typeof(TList<Dokument>))]
		DokumentCollectionGetByIDOrganizacijaPrema,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for KnjizenjeStavkaCollection
		///</summary>
		[ChildEntityType(typeof(TList<KnjizenjeStavka>))]
		KnjizenjeStavkaCollection,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for DokumentCollection
		///</summary>
		[ChildEntityType(typeof(TList<Dokument>))]
		DokumentCollectionGetByIDOrganizacijaOd,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for OrganizacijaCollection
		///</summary>
		[ChildEntityType(typeof(TList<Organizacija>))]
		OrganizacijaCollection,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for ObracunKamataCollection
		///</summary>
		[ChildEntityType(typeof(TList<ObracunKamata>))]
		ObracunKamataCollection,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for DokumentStavkaCollection
		///</summary>
		[ChildEntityType(typeof(TList<DokumentStavka>))]
		DokumentStavkaCollection,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for BlagajnaCollection
		///</summary>
		[ChildEntityType(typeof(TList<Blagajna>))]
		BlagajnaCollection,

		///<summary>
		/// Collection of <c>Organizacija</c> as OneToMany for OSKarticaCollection
		///</summary>
		[ChildEntityType(typeof(TList<OSKartica>))]
		OSKarticaCollection,
	}
	
	#endregion OrganizacijaChildEntityTypes
	
	#region OrganizacijaFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;OrganizacijaColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Organizacija"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class OrganizacijaFilterBuilder : SqlFilterBuilder<OrganizacijaColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the OrganizacijaFilterBuilder class.
		/// </summary>
		public OrganizacijaFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the OrganizacijaFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public OrganizacijaFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the OrganizacijaFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public OrganizacijaFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion OrganizacijaFilterBuilder
	
	#region OrganizacijaParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;OrganizacijaColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Organizacija"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class OrganizacijaParameterBuilder : ParameterizedSqlFilterBuilder<OrganizacijaColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the OrganizacijaParameterBuilder class.
		/// </summary>
		public OrganizacijaParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the OrganizacijaParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public OrganizacijaParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the OrganizacijaParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public OrganizacijaParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion OrganizacijaParameterBuilder
} // end namespace
